package com.desiy.service.impl;

import com.desiy.dao.AdminDao;
import com.desiy.entity.Admin;
import com.desiy.service.AdminService;
import com.desiy.vo.AdminVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * @author Desiy
 * @date 2020/9/4 14:07
 */
@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    AdminDao adminDao;

    @Override
    public Collection<Admin> adminList() {
        Collection<Admin> adminVOS = adminDao.adminList();
        return adminVOS;
    }

    @Override
    public List<Admin> adminListByUsername(String username) {
        List<Admin> admin = adminDao.adminListByUsername(username);
        return admin;
    }

    @Override
    public Admin login(String username, String password) {
        return adminDao.selectAdmin(username);
    }

    @Override
    public void add(String rel_name, String username, String password) {
        adminDao.add(rel_name, username, password);
    }

    @Override
    public void add(Admin admin) {
        adminDao.add(admin);
    }

    @Override
    public String selectPassword(String username) {
        return adminDao.selectPassword(username);
    }

    @Override
    public String selectUsername(String username) {
        return adminDao.selectUsername(username);
    }

    @Override
    public void del(Integer id) {
        adminDao.del(id);
    }

    @Override
    public AdminVO edit(Integer id) {
        return adminDao.edit(id);
    }
}
